/**
 * @file event.h
 * @author taylor peng
 * @brief 事件处理
 * @version 0.1
 * @date 2022-01-08
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#ifndef _EVENT_H
#define _EVENT_H

#include "bitmap.h"

//面板状态条
typedef enum
{
    TEMP_STATUS_ERROR = 0,
    TEMP_STATUS_OFF,
    TEMP_STATUS_SLEEP,
    TEMP_STATUS_BOOST,
    TEMP_STATUS_WORKY,
    TEMP_STATUS_HEAT,
    TEMP_STATUS_HOLD,
} TEMP_CTRL_STATUS_CODE;
extern const char* TempCTRL_Status_Mes[];

/** 烙铁头配置信息 */
typedef struct
{
    double PTemp[4];    //温度系数
    float PID[2][3];   //PID系数{远PID，近PID}
    unsigned char name[20];    //名称
} TIPCONFIG_S;

//最大烙铁头配置数量
#define MaxTipConfig        10
// TIPCONFIG_S MyTip[MaxTipConfig];

/** 事件类型 */
typedef enum {
    EVT_ONE_CLICK = 1,
    EVT_DOUBLE_CLICK,
    EVT_LONG_PRESS,
} EVENT_TYPE_E;

//温度限制
#define TipMaxTemp 300
#define TipMinTemp 0

void Sleep_SetEvent(unsigned char state);
unsigned char Sleep_GetEvent(void);
void SleepTrigerTime_Set(unsigned int tick);
unsigned int SleepTrigerTime_Get(void);
void SleepScreenProtect_Set(unsigned char state);
unsigned char SleepScreenProtect_Get(void);
void ScreenProtectorTimerUpdate_Set(unsigned int tick);
unsigned int ScreenProtectorTimerUpdate_Get(void);
void ScreenProtectorTrigerTime_Set(unsigned int tick);
unsigned int ScreenProtectorTrigerTime_Get(void);
void UnderVoltage_Set(unsigned char state);
unsigned char UnderVoltage_Get(void);
void BoostEvent_Set(unsigned char state);
unsigned char BoostEvent_Get(void);
void BoostTimer_Set(unsigned int tick);
unsigned int BoostTimer_Get(void);
void BoostDuringTime_Set(unsigned int tick);
unsigned int BoostDuringTime_Get(void);
void ShutdownTime_Set(unsigned int minute);
unsigned int ShutdownTime_Get(void);
void ShutdownEvent_Set(unsigned char state);
unsigned char ShutdownEvent_Get(void);
void BluetoothEvent_Set(unsigned char state);
unsigned char BluetoothEvent_Get(void);
void TemperatureCtrlEvent_Set(unsigned char state);
unsigned char TemperatureCtrlEvent_Get(void);
void TemperatureDiffEvent_Set(double temp_diff);
double TemperatureDiffEvent_Get(void);
void TemperatureVirtualEvent_Set(double virtual_temp);
double TemperatureVirtualEvent_Get(void);
void TemperatureRealityEvent_Set(double reality_temp);
double TemperatureRealityEvent_Get(void);
void PagesCornerTipEvent_Set(unsigned int tick);
unsigned int PagesCornerTipEvent_Get(void);
void Mac_Set(void);
char *Mac_GetString(void);
unsigned long Cpu_GetFreq(void);
char *Version_Get(void);
void TipNum_Set(unsigned char num);
unsigned char TipNum_Get(void);
void TipCallSleepEvent_Set(unsigned char state);
unsigned char TipCallSleepEvent_Get(void);
void TipConfigTemperature_Set(unsigned char tip_id, double temp[]);
double *TipConfigTemperature_Get(unsigned char tip_id);
void TipConfigPid_Set(unsigned char tip_id, float *pid, unsigned char row, unsigned char col);
float *TipConfigPid_Get(unsigned char tip_id);
void TipConfigName_Set(unsigned char tip_id, const unsigned char *name);
unsigned char *TipConfigName_Get(unsigned char tip_id);
void KeyEvent_Set(unsigned char key_type);
unsigned char KeyEvent_Get(void);
void Power_Set(unsigned short power);
unsigned short Power_Get(void);
void BoostButton_EventLoop(void);
void EventTimerUpdate_Set(unsigned int tick);
unsigned int EventTimerUpdate_Get(void);
void LockState_Set(unsigned char state);
unsigned char LockState_Get(void);
void TimerUpdateEvent(void);
void TimerEventLoop(void);
unsigned int Minute2Millis(float min);

#endif
